package com.bluesea.report.service.user.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.bluesea.report.dao.UserDao;
import com.bluesea.report.entity.User;
import com.bluesea.report.service.user.IUserService;

@Service("userService")
public class UserserviceImpl implements IUserService {
	
	@Resource
	public UserDao userDao;
	
	public User getUserByid(Integer id) {
		User user = userDao.selectByPrimaryKey(id);
		return user;
	}

	public List<User> selectAll() {
		List<User> userList = null;
		try {
			userList = userDao.selectAll();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return userList;
	}

	public boolean doUserLogin(User user) {
		System.out.println("----service登录参数：----"+user);
		List<User> list = userDao.selectByname(user.getUserName());
		if(list.size() == 0) {
			return false;
		}else {
			if(list.get(0).getPassword().equals(user.getPassword())) {
				return true;
			}else {
				return false;
			}
		}
	}

}
